answer "Because a significant number of cards have been " & "modified or deleted, you can reclaim approximately " & NumK & "k of available disk space by compacting this stack." with "Not Now" or "Compact"
if it is "Compact" then doMenu "Compact Stack"
end if
end CloseStack
on mouseWithin
Global LastField, TrapFieldName
-- Field Select, Copyright by Mac Help Co., January 1988
-- by Chris Hostetter, Mac Help Co., 1800 East Market Street
-- Long Beach, CA 90805, (213) 428-7414
-- This script is copyrighted and may not be
-- used without the written permission of the author (above).
if TrapFieldName is "Sort" then
if the visible of the message box is false then
put empty into TrapFieldName
exit MouseWithin
end if
set cursor to 2
if the commandkey is down then
put the name of the target into LastField
put empty into TrapFieldName
hide message box
answer "Sort in Ascending or Descending order?" with Ascending or Descending
if it is "Ascending" then do "sort ascending by" && LastField
if it is "Descending" then do "sort descending by" && LastField
end if
end if
if TrapFieldName is "Delete" then
if the visible of the message box is false then
put empty into TrapFieldName
exit MouseWithin
end if
set cursor to 2
if the commandkey is down then
put the name of the target into LastField
put empty into TrapFieldName
hide message box
ask "Ready to delete duplicates in field " with LastField
put the number of cards into TotalCards
put 0 into DeleteCount
set cursor to 4
repeat with i = 2 to TotalCards-DeleteCount
set lockscreen to false
go to card i of this background
set lockscreen to true
put the id of this card into StartID
-- GET WHATEVER FIELD YOU WANT TO FIND INFORMATION IN
do "Get" && LastField
repeat forever
find it
if the ID of this card is StartID then exit repeat
add 1 to DeleteCount
doMenu "Delete Card"
end repeat
end repeat
beep
beep
beep
answer DeleteCount && "duplicate cards found & deleted."
end if
end if
if TrapFieldName is "Sort List" then
if the visible of the message box is false then
put empty into TrapFieldName
exit MouseWithin
end if
set cursor to 2
if the commandkey is down then
put the name of the target into LastField
put empty into TrapFieldName
hide message box
"SortList"
end if
end if
end mouseWithin
on "SortList"
Global LastField
-- DELETE CARRIAGE RETURNS
set cursor to 4
set lockscreen to true
do "put the number of lines of" && LastField && "into TotalLines"
repeat with i = 0 to TotalLines-1
do "get line" && TotalLines-i && "of" && LastField
if it is empty then do "delete line" && TotalLines-i && "of" && LastField
end repeat
do "put the number of lines of" && LastField && "into TotalLines"